<?php
/**
 * Created by PhpStorm.
 * User: 王
 * Date: 2016/11/4
 * Time: 17:20
 */

namespace app\components\behaviors;


use yii\base\Behavior;
use yii\db\ActiveRecord;

class CstimeBehaviors extends Behavior
{
    public $createDate;
    public function events()
    {
        return [
            ActiveRecord::EVENT_BEFORE_INSERT => 'setValue',
        ];
    }

    public function setValue()
    {
        $this->owner->{$this->createDate}= date("Y-m-d H:i:s");
    }
}